#!/bin/sh
#
# /etc/rc.d/tor: start/stop tor daemon
#

# User settings here
DAEMON=tor
RUN_AS_USER=tor

# Check for configuration files
[ -f /etc/tor/torrc ] || exit 1

# If you have to edit this section for this or any other 
# port useage let me know, with a patch or added lines, 
# or simplely e-mail me the altered file and I'll include the changes.

RETVAL=0

case $1 in
start)
	echo -n "Starting $DAEMON..."
	su $RUN_AS_USER -c /usr/bin/$DAEMON > /dev/null & RETVAL=$?
	if [ $RETVAL = 0 ]; then
		echo " done."
	fi
	;;
stop)
	echo -n "Shutting down $DAEMON..."
	killall -q /usr/bin/$DAEMON
	RETVAL=$?
	echo " done."
	;;
restart)
	$0 stop
	sleep 5
	$0 start
	RETVAL=$?
	;;

baslat)
	echo -n "$DAEMON başlatılıyor..."
	su $RUN_AS_USER -c /usr/bin/$DAEMON > /dev/null & RETVAL=$?
	if [ $RETVAL = 0 ]; then
		echo " done."
	fi
	;;
durdur)
	echo -n "$DAEMON kapatılıyor..."
	killall -q /usr/bin/$DAEMON
	RETVAL=$?
	echo " done."
	;;
ybaslat)
	$0 stop
	sleep 5
	$0 start
	RETVAL=$?
	;;

*)
	echo "usage: $0 [start|stop|restart]"
	echo "Kullanımı: $0 [baslat|durdur|ybaslat]"
	exit 1
	;;
esac

exit $RETVAL

# End of file